/**
 @Author Zhenglinbin
 @Date 2021/3/31
 **/
import {RenderType} from '@/components/typing'

//出入库
export const storageSou:RenderType[] = [
    { value: 1, label: '最小单元原料出入退库' },
    { value: 2, label: '原料出入退库' },
    { value: 3, label: '产成品/半成品/联产品出入退库' },
    { value: 4, label: '辅料出入退库' },
    { value: 5, label: '备件出入退库' }
]
//出库
export const outSou:RenderType[] = [
    { value: 1, label: '最小单元原料出库' },
    { value: 2, label: '原料出库' },
    { value: 3, label: '产成品/半成品/联产品出库' },
    { value: 4, label: '辅料出库' },
    { value: 5, label: '备件出库' }
]
//物料类型
export const materialSou:RenderType[] = [
    { value: 1, label: '最小单元原料' },
    { value: 2, label: '原料' },
    { value: 3, label: '产成品/半成品/联产品' },
    { value: 4, label: '辅料' },
    { value: 5, label: '备件' }
]
//投料类型
export const feedingSou:RenderType[] = [
    { value: 2, label: '正常投料' },
    { value: 7, label: '研发投料' },
    { value: 9, label: '返工投料' }
]
//投料记录状态 状态（0-生产保存；1-生产提交；2-实验室保存；3-实验室提交）
export const recordSou:RenderType[] = [
    { value: 0, label: '保存' },
    { value: 1, label: '提交' },
    { value: 2, label: '实验室保存' },
    { value: 3, label: '实验室提交' },
    { value: 4, label: '已冲销' }
]
export const calculateSou:RenderType[] = [
    { value: '*', label: '乘' },
    { value: '/', label: '除' },
    { value: '+', label: '加' },
    { value: '-', label: '减' }
]
export const purposeSou:RenderType[] = [
    { value: 1, label: '生产领用' },
    { value: 2, label: '部门领用' },
    { value: 3, label: '项目领用' },
    { value: 4, label: '研发领用' }
]
export const outStoreSou:RenderType[] = [
    { value: 0, label: '保存' },
    { value: 1, label: '提交' },
    { value: 2, label: '冲销' }
]

export default {
    storageState: (value: number): string => {
        const datas = storageSou.filter(item => item.value === value);
        return datas && datas.length > 0 ? datas[0]?.label : ''
    },
    outState: (value: number): string => {
        const datas = outSou.filter(item => item.value === value);
        return datas && datas.length > 0 ? datas[0]?.label : ''
    },
    materialState: (value: number): string => {
        const datas = materialSou.filter(item => item.value === value);
        return datas && datas.length > 0 ? datas[0]?.label : ''
    },
    feedingState: (value: number): string => {
        const datas = feedingSou.filter(item => item.value === value);
        return datas && datas.length > 0 ? datas[0]?.label : ''
    },
    recordState: (value: number): string => {
        const datas = recordSou.filter(item => item.value === value);
        return datas && datas.length > 0 ? datas[0]?.label : ''
    },
    calculateState: (value: string): string => {
        const datas = calculateSou.filter(item => item.value === value);
        return datas && datas.length > 0 ? datas[0]?.label : ''
    },
    purposeState: (value: number): string => {
        const datas = purposeSou.filter(item => item.value === value);
        return datas && datas.length > 0 ? datas[0]?.label : ''
    },
    outStoreState: (value: number): string => {
        const data = outStoreSou.find(item => item.value === value);
        return data ? data.label : ''
    }
}


